<?php

/**
 * This is the model class for table "review_systems".
 *
 * The followings are the available columns in table 'review_systems':
 * @property integer $id
 * @property string $fever_weight_loss_or_gain
 * @property string $integumentary
 * @property string $neurological
 * @property string $headaches
 * @property string $migrains
 * @property string $seizures
 * @property string $eyes
 * @property string $loss_of_vision
 * @property string $distorted_vision
 * @property string $loss_side_vision
 * @property string $double_vision
 * @property string $dryness
 * @property string $mucousdischarge
 * @property string $redness
 * @property string $sandy_gritty_feeling
 * @property string $itching
 * @property string $burning
 * @property string $foreign_body_sensation
 * @property string $excess_tearing
 * @property string $glare
 * @property string $soreness
 * @property string $chronicinfection_on_eyes
 * @property string $sties
 * @property string $Flashes
 * @property string $tiredeyes
 * @property string $endocrine
 * @property string $thyroid_othe_rgland
 * @property string $chief_complains
 * @property string $medication_taken
 * @property integer $personalinfo_id
 *
 * The followings are the available model relations:
 * @property PersonalInformation $personalinfo
 */
class ReviewSystems extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return ReviewSystems the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'review_systems';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('personalinfo_id', 'required'),
			array('personalinfo_id', 'numerical', 'integerOnly'=>true),
			array('fever_weight_loss_or_gain, integumentary, neurological, headaches, migrains, seizures, eyes, loss_of_vision, distorted_vision, loss_side_vision, double_vision, dryness, mucousdischarge, redness, sandy_gritty_feeling, itching, burning, foreign_body_sensation, excess_tearing, glare, soreness, chronicinfection_on_eyes, sties, Flashes, tiredeyes, endocrine, thyroid_othe_rgland', 'length', 'max'=>5),
			array('chief_complains, medication_taken', 'length', 'max'=>300),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, fever_weight_loss_or_gain, integumentary, neurological, headaches, migrains, seizures, eyes, loss_of_vision, distorted_vision, loss_side_vision, double_vision, dryness, mucousdischarge, redness, sandy_gritty_feeling, itching, burning, foreign_body_sensation, excess_tearing, glare, soreness, chronicinfection_on_eyes, sties, Flashes, tiredeyes, endocrine, thyroid_othe_rgland, chief_complains, medication_taken, personalinfo_id', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'personalinfo' => array(self::BELONGS_TO, 'PersonalInformation', 'personalinfo_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'fever_weight_loss_or_gain' => 'Fever Weight Loss Or Gain',
			'integumentary' => 'Integumentary',
			'neurological' => 'Neurological',
			'headaches' => 'Headaches',
			'migrains' => 'Migrains',
			'seizures' => 'Seizures',
			'eyes' => 'Eyes',
			'loss_of_vision' => 'Loss Of Vision',
			'distorted_vision' => 'Distorted Vision',
			'loss_side_vision' => 'Loss Side Vision',
			'double_vision' => 'Double Vision',
			'dryness' => 'Dryness',
			'mucousdischarge' => 'Mucousdischarge',
			'redness' => 'Redness',
			'sandy_gritty_feeling' => 'Sandy Gritty Feeling',
			'itching' => 'Itching',
			'burning' => 'Burning',
			'foreign_body_sensation' => 'Foreign Body Sensation',
			'excess_tearing' => 'Excess Tearing',
			'glare' => 'Glare',
			'soreness' => 'Soreness',
			'chronicinfection_on_eyes' => 'Chronicinfection On Eyes',
			'sties' => 'Sties',
			'Flashes' => 'Flashes',
			'tiredeyes' => 'Tiredeyes',
			'endocrine' => 'Endocrine',
			'thyroid_othe_rgland' => 'Thyroid Othe Rgland',
			'chief_complains' => 'Chief Complains',
			'medication_taken' => 'Medication Taken',
			'personalinfo_id' => 'Patient name',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('fever_weight_loss_or_gain',$this->fever_weight_loss_or_gain,true);
		$criteria->compare('integumentary',$this->integumentary,true);
		$criteria->compare('neurological',$this->neurological,true);
		$criteria->compare('headaches',$this->headaches,true);
		$criteria->compare('migrains',$this->migrains,true);
		$criteria->compare('seizures',$this->seizures,true);
		$criteria->compare('eyes',$this->eyes,true);
		$criteria->compare('loss_of_vision',$this->loss_of_vision,true);
		$criteria->compare('distorted_vision',$this->distorted_vision,true);
		$criteria->compare('loss_side_vision',$this->loss_side_vision,true);
		$criteria->compare('double_vision',$this->double_vision,true);
		$criteria->compare('dryness',$this->dryness,true);
		$criteria->compare('mucousdischarge',$this->mucousdischarge,true);
		$criteria->compare('redness',$this->redness,true);
		$criteria->compare('sandy_gritty_feeling',$this->sandy_gritty_feeling,true);
		$criteria->compare('itching',$this->itching,true);
		$criteria->compare('burning',$this->burning,true);
		$criteria->compare('foreign_body_sensation',$this->foreign_body_sensation,true);
		$criteria->compare('excess_tearing',$this->excess_tearing,true);
		$criteria->compare('glare',$this->glare,true);
		$criteria->compare('soreness',$this->soreness,true);
		$criteria->compare('chronicinfection_on_eyes',$this->chronicinfection_on_eyes,true);
		$criteria->compare('sties',$this->sties,true);
		$criteria->compare('Flashes',$this->Flashes,true);
		$criteria->compare('tiredeyes',$this->tiredeyes,true);
		$criteria->compare('endocrine',$this->endocrine,true);
		$criteria->compare('thyroid_othe_rgland',$this->thyroid_othe_rgland,true);
		$criteria->compare('chief_complains',$this->chief_complains,true);
		$criteria->compare('medication_taken',$this->medication_taken,true);
		$criteria->compare('personalinfo_id',$this->personalinfo_id);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
	public function getFName()
        {       
        return $this->personal_information['FullName']; 
        }
}